<template>
  <div class="page-container">
    <ex_super_table_page v-bind="option" ref="SuperTablePage">
    </ex_super_table_page>
    <ex_super_dialog_form ref="formDialog" :title="dialogTitle" v-bind="dialog"
      @afterSubmitSuccess="$refs['SuperTablePage'].reload()">

    </ex_super_dialog_form>
  </div>
</template>
<script>
import superTablePageFunction from '@/mixin/super-table-page-function';

export default {
  title: 'label_anomaly_class',
  mixins: [superTablePageFunction],
  components: {},
  data() {
    return {
      option: {
        action: [
          {
            label: { _key: 'label_new_any',i18n: true, type: 'label_anomaly_class' }, attrs: { icon: "el-icon-plus" }, 
            auth:'oms_anomaly_class_edit',
            click: () => {
              this.dialogTitle = this.$tt({ _key: 'label_new_any',i18n: true, type: 'label_anomaly_class' })
              this['$refs']['formDialog'].show(null, { setData: true })
            }
          },
        ],
        table: {
          autoPage: false,
          url: "/oms-api/anomaly/OmsBaseAnomalyClassifyRpc/selectAll.json",
          model: [
            { key: 'name', label: 'label_name', 'min-width': 200, 'show-overflow-tooltip': true, },
            { key: 'remark', label: 'label_remark', 'min-width': 200, 'show-overflow-tooltip': true, },
            {
              type: 'operate', width: 160, operate: [

                {
                  label: 'label_delete',
                  auth:'oms_anomaly_class_delete',
                  type: "confirm-button",
                  url: '/oms-api/anomaly/OmsBaseAnomalyClassifyRpc/remove.json',
                  message: 'text_confirm_sure_delete',
                  buttonClass: "button_text_danger",
                  confirmButtonType: 'danger',
                  params: (row) => {
                    return { "id": row["id"] }
                  },
                  done: ['reload', 'tip']
                }
              ]
            }
          ],
        }
      },

      dialogTitle: '',
      dialog: {
        customClass: 'dialog_auto',
        submitUrl: '/oms-api/anomaly/OmsBaseAnomalyClassifyRpc/save.json',
        detailUrl: '/oms-api/anomaly/OmsBaseAnomalyClassifyRpc/selectAll.json',

        form: {
          itemClass: "form_item_default", inputClass: "form_input_default",
          default: { },
          model: [
            { header: "label_base_info", },
            { key: 'name', label: 'label_name', attrs: { maxlength: 50, 'show-word-limit': true } },
            { key: 'remark', label: 'label_remark', attrs: { type: 'textarea', autosize: { minRows: 2, maxRows: 6 }, maxlength: 200, 'show-word-limit': true } },
          ],
          rules: {
            'name': { required: true, message: this.$tt('tip_can_no_empty'), trigger: 'blur' },
            'remark': { required: true, message: this.$tt('tip_can_no_empty'), trigger: 'blur' },

          },
        }
      },
    };
  },
  methods: {}
};

</script>
<style></style>
